# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua-uuid
_realname=uuid
pkgver=0.3
pkgrel=0
pkgdesc="A pure Lua uuid generator (modified from a Rackspace module)"
url="https://tieske.github.io/uuid/"
arch="noarch"
license="Apache-2.0"
options="!check"
source="$pkgname-$pkgver.tar.gz::https://github.com/Tieske/uuid/archive/$pkgver.tar.gz"
builddir="$srcdir/uuid-$pkgver"

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
done

package() {
	mkdir -p "$pkgdir"
}

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"

	install -Dm644 "$builddir"/src/uuid.lua \
		"$subpkgdir"/usr/share/lua/$lver/uuid.lua
}

sha512sums="
b003fa36d47e5e325abb261ccfdfa3457455da4ddafa551f316cf8c7269db97f9f9ec7a056533defece316fb149911c0f00013a89293ee0b898e3fd5cd79541f  lua-uuid-0.3.tar.gz
"
